package com.baizhi.controller;

import com.baizhi.entity.Comment;
import com.baizhi.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    private CommentService commentService;
    @PostMapping("/")
    public void addComment(@RequestBody Comment comment) {
        commentService.insertComment(comment);
    }

    @DeleteMapping("/{cId}/{uId}")
    public void deleteCommentByCIdAndUId(@PathVariable("cId") Integer cId,
                                         @PathVariable("uId") Integer uId) {
        commentService.deleteComment(cId,uId);
    }
}
